home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C ++ / Applications / TimGA 1.2.1 / .cp / CMyCaption.cp < prev    next >
Encoding:
Text File  |  1997-07-16  |  1.4 KB  |  50 lines  |  [TEXT/CWIE]

  1. // ===========================================================================
  2. //    CMyCaption.cp            ©1995-97 Timo Eloranta        All rights reserved.
  3. // ===========================================================================
  4. //    A subclass of LCaption which uses TETextBox for drawing just like
  5. //  LCaption did before this changed in CW7...
  6.  
  7. #include "CMyCaption.h"
  8. #include <LStream.h>
  9. #include <UDrawingUtils.h>
  10. #include <UTextTraits.h>
  11.  
  12. #ifndef __TEXTUTILS__
  13. #include <TextUtils.h>
  14. #endif
  15.  
  16. // ---------------------------------------------------------------------------
  17. //        • CMyCaption( LStream* )
  18. //
  19. //          Called by:    URegistrar::CreateObject
  20. // ---------------------------------------------------------------------------
  21. //    Construct from data in a Stream
  22.  
  23. CMyCaption::CMyCaption( LStream *inStream) 
  24.     : LCaption( inStream )
  25. {
  26. }
  27.  
  28. // ---------------------------------------------------------------------------
  29. //        • DrawSelf
  30. // ---------------------------------------------------------------------------
  31. //    Draw the Caption
  32.  
  33. void
  34. CMyCaption::DrawSelf()
  35. {
  36.     Rect    frame;
  37.     CalcLocalFrameRect(frame);
  38.     
  39.     Int16    just = UTextTraits::SetPortTextTraits(mTxtrID);
  40.     
  41.     RGBColor    textColor;
  42.     ::GetForeColor(&textColor);
  43.     
  44.     ApplyForeAndBackColors();
  45.     ::RGBForeColor(&textColor);
  46.     
  47.     ::TETextBox((Ptr)&mText[1], mText[0], &frame, just);    // The difference
  48. //    UTextDrawing::DrawWithJustification((Ptr)&mText[1], mText[0], frame, just);
  49. }
  50.